<?php
/**
 * Created by PhpStorm.
 * User: ownfi
 * Date: 2017-03-29
 * Time: 12:39
 */

namespace App\Services;

use App\Models\MasterWallet;

/**
 * 师傅钱包
 * Interface IWalletService
 * @package App\Services
 */
interface IWalletService
{

    /**
     * 获取用户钱包数据
     * @param $userid
     * @return mixed
     */
    public function getWalletByUserid($master_id);

    /**
     * 是否已设置钱包密码
     * @param $master_id
     * @return mixed
     */
    public function issetPassword($master_id);

    /**
     * 更改钱包密码
     * @param $master_id
     * @param $password
     * @return mixed
     */
    public function changePassword($master_id,$password);

    /**
     * 检验钱包密码
     * @param $master_id
     * @param $password
     * @return mixed
     */
    public function verifyPassword($master_id,$password);

    /**
     * 是否已设置提现账户
     * @param $master_id
     * @return mixed
     */
    public function issetAlipayAccount($master_id);

    /**
     * 支付宝提现账号绑定
     * @param $master_id
     * @param $alipay_name
     * @param $alipay_account
     * @return mixed
     */
    public function alipayAccountBind($master_id,$alipay_name,$alipay_account);

    /**
     * 发起提现申请
     * @return mixed
     */
    public function applyCash(MasterWallet $masterWallet,$amount);

    /**
     * 取得正在提现中的金额总和
     * @param $master_id
     * @return mixed
     */
    public function getCashingAmount($master_id);

    /**
     * 生成诚信保证金订单
     * @param $master_id
     * @param $amount
     * @return mixed
     */
    public function genAssureFundOrder($master_id,$amount);

    /**
     * 用钱包余额支付交易
     * @param $trade_number
     * @return mixed
     */
    public function pay($trade_number);

    /**
     * 退还诚信保证金
     * @param $master_id
     * @param $amount
     * @return mixed
     */
    public function returnAssureFund($master_id);

    /**
     * 从钱包余额中扣除额度
     * @param $amount
     * @return mixed
     */
    public function subtractBalance($trade_id,$master_id,$amount);

    /**
     * 钱包余额增加额度
     * @param $amount
     * @return mixed
     */
    public function raiseBalance($trade_id,$master_id, $amount);

    /**
     * 从质保金中扣除额度
     * @param $amount
     * @return mixed
     */
    public function subtractAssureFund($trade_id,$master_id,$amount);

    /**
     * 质保金增加额度
     * @param $amount
     * @return mixed
     */
    public function raiseAssureFund($trade_id,$master_id, $amount);
}